#include "udf_global.h"

#if ( UDF_EN_01 > 0 && !defined(UDP_SUB_PROJECT) && !defined(UDT_SUB_PROJECT) && (defined(UDF01_SUB_PROJECT) || defined(UDF_PRJ)) )

#include "udsf.h"

#include "../udsf/udsf_uart.c"
#include "../udsf/udsf_cstdlike.c"
#include "../udsf/udsf_delay.c"
#include "../udsf/udsf_memory_access.c"
#include "../UDF/rom_function2_process.c"
#include "../udsf/udsf_spi.c"
#include "../udsf/udsf_gpio.c"
#include "../udsf/udsf_protocol.c"
#include "../udsf/udsf_lpw.c"
#include "../udsf/udsf_dbscan.c"
#include "../udsf/udsf_data_send.c"
#include "../udsf/udsf_udf_switch.c"
#include "../udsf/udsf_data_acquisition.c"
#include "../udsf/udsf_cfar.c"
#include "../udsf/udsf_bbe.c"
#include "../udsf/udsf_i2c_slave.c"
	
// 基于UDF03/UDF13点云结果继续处理
void UDF01_udf_handle(void){
  
  

	// close wdt
	NVIC->ICER[0] = (1 << ((uint32_t)(WDT_IRQn) & 0x1F));
	SYSC->CLK_EN &= ~WDT_PATTERN_EN_Msk;
	SYSC->CLK_EN |= (WDT_PATTERN_EN_Msk&(WDT_PATTERN_DISABLE<<WDT_PATTERN_EN_Pos)); // Close WDT clock 	
 int page_cnt = 1; 
 uint32_t download_addr = BBE_ABUF0_BASE;
//   udsf_i2c_init();//i2c
  sUDF_global.i2c_regaa = 0xF1;
  sUDF_global.ota_status = OTA_STATUS_DOWNLOAD;
//	LOG_SEND_STRING(LOG_LEVEL_NOTICE,"\nudf01 startup\n");

//	LOG_SEND_STRING(LOG_LEVEL_EMERG,"\nudf01 demo\n");
         sUDF_global.i2c_reg10 = 0x0D; 
//        printf("range1 = %dcm,range2 = %dcm,pow = %d \r\n",index_range,frame_range,Pow_once);
//        uint16_t Crc16 = udsf_get_crc((uint8_t*)(Bin_data),6);
         udsf_spiflash_write_data(&sUDF_global.i2c_reg10,IIC_Para_ADDR,1);


         sUDF_global.i2c_reg10 = 0X0E;
         udsf_spiflash_write_data(&sUDF_global.i2c_reg10,IIC_Para_ADDR,1);
    
				
				//udsf_uart_send_string("[OTA Demo]: WILL RESET...\n");
				udsf_udf_switch(3,1,0);
				WDT_RSTNOW();
				while(1);

      
  
}
#endif
